package it.polimi.leo.mw;

import java.io.Serializable;

public interface IMiddleWare {
	/*
	 * if group == null then create not connected node
	 */
	IMiddleWareNode createNode(IMiddleWareGroup group) throws JoinGroupException;
	
	IMiddlewareMessageFactory getIMiddlewareMessageFactory();
	
	public static enum IMiddlewareMessageKind {
		START_ELECTION,
		BECOME_A_SUPERVISOR,
		BECOME_A_FOLLOWER,
		UPDATE_STATE,
		GIVE_FITNESS,
		DO_TASK,
		DATA,
	}
	
	public static  interface IMiddlewareMessageFactory {
		IMiddlewareMessage createBecomeAsuperviserMsg(IMiddleWareGroup g);
		IMiddlewareMessage createDataMsg(Object data);
		IMiddlewareMessage createGiveFitnessMsg(IMiddleWareGroup g);
	}
	
}
